using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DBManager;
using MamNonTuoiTho.Form.QuanLyHocSinh;
using MamNonTuoiTho.Form.QuanLyChamCong;
using MamNonTuoiTho.Form.DanhMucHeThong;
namespace MamNonTuoiTho
{
    public partial class frmMain : DevComponents.DotNetBar.Office2007RibbonForm
    {
        public frmMain()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;
            
        }
        #region FunctionCommon
        private void ShowChildForm(System.Windows.Forms.Form Frm)
        {
            System.Windows.Forms.Form[] forms = this.MdiChildren;
            if (forms.Length > 0)
            {
                foreach (System.Windows.Forms.Form ChildForm in this.MdiChildren)
                {
                    if (ChildForm.Name == Frm.Name)
                    {
                        ChildForm.Activate();
                        return;
                    }
                    else
                    {
                        Frm.MdiParent = frmMain.ActiveForm;
                        Frm.StartPosition = FormStartPosition.CenterScreen;
                        Frm.Show();
                    }
                }
            }
            else
            {
                Frm.MdiParent = frmMain.ActiveForm;
                Frm.StartPosition = FormStartPosition.CenterScreen;
                Frm.Show();
            }

        }
        #endregion FunctionCommon
        #region Phan He QuanLyHocSinh
        private void cmdDanhMucHuyen_Click(object sender, EventArgs e)
        {
            frmHuyen Huyen = new frmHuyen();
            ShowChildForm(Huyen);
        }
        private void cmdDanhMucXa_Click(object sender, EventArgs e)
        {
            frmXa Xa = new frmXa();
            ShowChildForm(Xa);
        }
        
        #endregion Phan He QuanLyHocSinh

        private void buttonItem1_Click(object sender, EventArgs e)
        {
            frmChamCong ChamCong = new frmChamCong();
            ShowChildForm(ChamCong);
        }

        private void cmdDanhMucGiaoVien_Click(object sender, EventArgs e)
        {
            frmGiaoVien GiaoVien = new frmGiaoVien();
            ShowChildForm(GiaoVien);
        }

       
    }
}